package innerClass;

/**
 * @Author:zimmor
 * @Date: 2021/3/23 22:56
 * @Description
 * @version: 1.0.0
 */

public class InnerClassDemo {
    public void test(Listener listener){
        listener.print();
        System.out.println(listener.getListener());
    }
    public void test2(AbstrctClassDemo abstrctClassDemo){
        System.out.println(abstrctClassDemo.getName());
        abstrctClassDemo.printLog();
    }
    public static void main(String[] args) {
        InnerClassDemo inner = new InnerClassDemo();
        inner.test(new Listener() {
            public void print() {
                System.out.println("print方法执行");
            }

            public String getListener() {
                return "innerListener";
            }
        });
        inner.test2(new AbstrctClassDemo() {
            @Override
            String getName() {
                return "abstracName";
            }

            @Override
            void printLog() {
                System.out.println("匿名内部内类log");
            }
        });

    }
}
